package de.pixel83.piecemaster;

// Copyright (c) 2012 Christian Kollross / Michael Freymueller

public class Move {
	/*
	 * New class Move public Square fields "from", "to" Constructor
	 * "Move(String)" Method "toString()" "Board.move(Move)"
	 */
	public final Square from;
	public final Square to;

	/**
	 * Constructor expecting a string of the form "a5-b4"
	 * 
	 * @param move
	 */
	public Move(String move) {
		assert (move.length() == 5);

		from = new Square(move.substring(0, 2));
		to = new Square(move.substring(3, 5));
	}

	/**
	 * Returns the move as a String like "a5-b4"
	 */
	public String toString() {
		return from.toString() + "-" + to.toString();
	}

	public static void main(String[] Args) {
		Move mov = new Move("c4-d5");

	}
	
	public boolean equals(Move mov) {
		if(this.toString().equals(mov.toString()))
			return true;
		return false;
		
	}
}